<?php
/**
 * +----------------------------------------------------------------------
 * | Author: 罗极
 * +----------------------------------------------------------------------
 * | Description: ResponseAbstracts.php
 * +----------------------------------------------------------------------
 * | User: Administrator Date: 8/21/ 0021 Time: 13:57
 * +----------------------------------------------------------------------
 */

namespace Framework\Response\Abstracts;

use Framework\Response\Constant\HttpCode;

abstract class ResponseAbstracts
{

    protected $code = 200;
    protected $msg  = '';


    protected function sendCode()
    {
        $codeMsg = HttpCode::Status[$this->code];
        $codeMsg = empty($codeMsg) ? HttpCode::Status[404] : $codeMsg;
        header($codeMsg);
    }


    protected function sendMsg()
    {
        echo $this->msg;
        exit;
    }

    abstract public function response();



    /**
     * @return mixed
     */
    public function getCode() : int
    {
        return $this->code;
    }

    /**
     * @param mixed $code
     */
    public function setCode(int $code)
    {
        $this->code = $code;
    }

    /**
     * @return mixed
     */
    public function getMsg() : string
    {
        return $this->msg;
    }

    /**
     * @param mixed $msg
     */
    public function setMsg(string $msg)
    {
        $this->msg = $msg;
    }

}